package com.huichaoliu.stylist.activity;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.TextView;

import com.huichaoliu.app.R;
import com.rederxu.farmer.BaseActivity;

public class StylistShiyijianActivity extends BaseActivity {

	private int[] cloth = { R.drawable.model_sy_002, R.drawable.model_sy_003,
			R.drawable.model_sy_005 };
	private int[] pants = { R.drawable.model_kz_001, R.drawable.model_kz_002,
			R.drawable.model_kz_003 };
	private int[] shoes = { R.drawable.model_sx_001, R.drawable.model_sx_002 };
	private Gallery galleryCloth = null;
	private Gallery galleryPants = null;
	private Gallery galleryShoes = null;
	private ImageView ic_model = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_stylist_shiyijian);
		super.onCreate(savedInstanceState);
		initViews();
	}

	public void initViews() {
		findViewById(R.id.stylist_back).setOnClickListener(
				new OnClickListener() {

					@Override
					public void onClick(View arg0) {
						finish();
					}
				});
		((TextView) findViewById(R.id.stylist_name)).setText("试衣间");
		findViewById(R.id.btn_gomarket).setOnClickListener(
				new OnClickListener() {

					@Override
					public void onClick(View arg0) {
						startActivity(StylistShoppingActivity.class);
					}
				});

		ic_model = (ImageView) findViewById(R.id.ic_model_stylist);
		galleryCloth = (Gallery) findViewById(R.id.galleryCloth_stylist);
		galleryPants = (Gallery) findViewById(R.id.galleryPants_stylist);
		galleryShoes = (Gallery) findViewById(R.id.galleryShoes_stylist);
		galleryCloth.setAdapter(new Adapter_stylist(cloth));
		galleryPants.setAdapter(new Adapter_stylist(pants, 1));
		galleryShoes.setAdapter(new Adapter_stylist(shoes));

	}

	@Override
	public void initData() {
		// TODO Auto-generated method stub

	}

	@Override
	public void onNetworkChanged(boolean isMobNetConnected,
			boolean isWifiConnected) {
		// TODO Auto-generated method stub

	}

	@Override
	public void init() {
		// TODO Auto-generated method stub
	}

	private class Adapter_stylist extends BaseAdapter {

		private int[] data = null;
		private int type = -1;

		public Adapter_stylist(int[] data) {
			this.data = data;
		}

		public Adapter_stylist(int[] data, int type) {
			this.data = data;
			this.type = type;
		}

		@Override
		public int getCount() {
			// TODO Auto-generated method stub
			return data.length;
		}

		@Override
		public Object getItem(int position) {
			// TODO Auto-generated method stub
			return null;
		}

		@Override
		public long getItemId(int position) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			// TODO Auto-generated method stub
			if (convertView == null) {
				convertView = new ImageView(StylistShiyijianActivity.this);
			}
			ImageView ic = (ImageView) convertView;
			ic.setImageResource(data[position]);
			return ic;
		}

	}

}
